package com.rogo.log
{
	import mx.core.mx_internal;
	import mx.logging.targets.LineFormattedTarget;
	
	use namespace mx_internal;

	/**
	 * 接收程序日志的目标
	 * 
	 * @author Rogo
	 */	
	public class AppLogTarget extends LineFormattedTarget
	{
		public function AppLogTarget()
		{
			init();
		}
		
		//--------------------------------------------------------------------------
		//
		//  Variables
		//
		//--------------------------------------------------------------------------
		
		private var logFile:AppLogFile;
		
		//--------------------------------------------------------------------------
		//
		//  Methods
		//
		//--------------------------------------------------------------------------
		
		private function init():void
		{
			includeCategory = true;
			includeDate = true;
			includeLevel = true;
			includeTime = true;
			
			logFile = new AppLogFile();
		}
		
		override mx_internal function internalLog(message:String):void
		{
			logFile.saveLog(message);
		}
		
	}
}